﻿using MahApps.Metro.Controls;
using Prism.Ioc;
using Prism.Regions;
using PrismMetroSample.Infrastructure.Constants;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace PrismMetroSample.Shell.Views
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : MetroWindow
    {
        public MainWindow()
        {
            InitializeComponent();
            var regionManger = ContainerLocator.Current.Resolve<IRegionManager>();
            if (regionManger != null)
            {
                SetRegionManager(regionManger, this.flyoutsControlRegion, RegionNames.FlyoutRegion);
                SetRegionManager(regionManger, this.rightWindowCommandsRegion, RegionNames.ShowSearchPatientRegion);
            }

        }

        void SetRegionManager(IRegionManager regionManager, DependencyObject regionTarget, string regionName)
        {
            RegionManager.SetRegionName(regionTarget, regionName);
            RegionManager.SetRegionManager(regionTarget, regionManager);
        }
    }
}
